#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
bool is_leapyear(int y)
{
	if ((y % 4 == 0 && y % 100 != 0) || (y % 400 == 0))
		return 1;
	return 0;
}
int  cnt;
int a[1500];
int main()
{
	int x, y;
	cin >> x >> y;
	for (int i = x; i <= y; i++)
	{
		if (is_leapyear(i))
		{
			a[cnt] = i;
			cnt++;
		}
	}
	cout << cnt << endl;
	for (int i = 0; i <cnt; i++)
		cout << a[i] << " ";
	cout << endl;
	return 0;
}